home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 2006 February
/
Gamestar_81_2006-02_dvd.iso
/
Red Shark
/
Missions
/
Mission_7
/
MissionTasks.script
< prev
next >
Wrap
Text File
|
2001-12-19
|
8KB
|
435 lines
//-------------------------------------------------------------------
//
// This code is copyright 2001 by G5 Software.
// Any unauthorized usage, either in part or in whole of this code
// is strictly prohibited. Violators WILL be prosecuted to the
// maximum extent allowed by law.
//
//-------------------------------------------------------------------
///////////////////////////////////
//
// Mission 7. Break ring (Kursk Ark)
//
//
class CMission7_AIController extends CBaseAIController
{
array ActivatePointCenterList = array(
vector( 8600, 10800, 0), // ring is broken
vector( 7360, 9900, 0), // B
vector( 7526, 10640, 0), // D
vector( 5800, 9040, 0), // E
vector( 4600, 7760, 0), // F
vector( 4600, 7760, 0), // G
vector( 5580, 8020, 0), // H
vector( 6520, 6260, 0), // L
vector( 6520, 6260, 0), // K
vector( 8090, 4900, 0), // N
vector( 8090, 4900, 0), // SovietWall
vector( 9390, 4460, 0), // convoy stop (1)
vector( 12200, 4706, 0)); // convoy stop (2)
array ActivatePointRadiusList = array(
20.0, // radius of "ring is broken"
80.0,
80.0,
80.0,
80.0,
80.0,
80.0,
80.0,
80.0,
80.0,
150.0,
20.0,
100.0);
array ActivatePointNameList = array(
"Broken",
"B",
"D",
"E",
"F",
"G",
"H",
"L",
"K",
"N",
"SovietWall",
"ConvoyStop",
"ConvoyStop2");
void OnObjectEnterArea( int _NavPointIndex, string _NavPointName, string _ObjectID)
{
Core_LogMessage("GameObject <" + _ObjectID + "> entered activate area");
if ( _NavPointName == "Broken"
&& Core_IsStringStartsWith( _ObjectID, "Soviet"))
{
// Ring is broken
Core_BroadcastEvent("OnRingIsBroken");
};
if ( _NavPointIndex >= 1 && _NavPointIndex <= 10
&& Core_IsStringStartsWith( _ObjectID, "Soviet"))
{
// activate ambush
Core_BroadcastEvent("OnActiveArea_" + ActivatePointNameList[_NavPointIndex]);
}
if ( _NavPointIndex == 11
&& Core_IsStringStartsWith( _ObjectID, "SovietConvoy"))
{
Core_BroadcastEvent("OnConvoyStop");
};
if ( _NavPointIndex == 12
&& Core_IsStringStartsWith( _ObjectID, "SovietConvoy"))
{
Core_BroadcastEvent("OnConvoyStop2");
};
};
}
class CMission7_SovietAttack extends CBaseAITask_Patrol
{
int m_StartTime;
boolean m_ActivateOnTimer = true;
void Init()
{
DeactivatePatrol();
SetFireStyle_NoFire();
m_StartTime = GetGameTime();
}
void OnUpdate()
{
if ( m_ActivateOnTimer)
{
if ( GetGameTime() > m_StartTime + 60000)
{
m_ActivateOnTimer = false;
ActivatePatrol();
SetFireStyle_Nearest();
};
};
};
void OnGroupABroken()
{
ActivatePatrol();
};
array GetPatrolTrip()
{
return array(
vector( 9100, 10326, 0),
vector( 7526, 10639, 0),
vector( 6257, 9677, 0),
vector( 4753, 6481, 0),
vector( 8924, 4377, 0),
vector( 12200, 4706, 0));
}
float GetTripSpeed()
{
return 24;
}
boolean Stopped = false;
void OnConvoyStop()
{
if ( !Stopped)
{
DeactivatePatrol();
SetOrder_StopNow();
Stopped = true;
};
}
void OnConvoyStop2()
{
DeactivatePatrol();
SetOrder_StopNow();
Stopped = true;
}
void OnConvoyContinue()
{
ActivatePatrol();
};
void OnEnemyTargeted() {} // do not attack
}
class CMission7_NaziAttack extends CBaseAITask_BaseTask
{
int m_StartTime;
boolean m_Active = false;
void Init()
{
m_StartTime = GetGameTime();
SetFireStyle_NoFire();
}
void OnUpdate()
{
if ( !m_Active)
{
if ( GetGameTime() > m_StartTime + 60000)
{
DoAttack();
};
};
}
/*
void OnGroupABroken()
{
DoAttack();
}
*/
void OnRingIsBroken()
{
DoAttack();
}
void DoAttack()
{
SetFireStyle_Nearest();
string NearestEnemy = GetTargetedEnemy();
if ( NearestEnemy == "")
{
NearestEnemy = GetNearestEnemyUnit();
};
SetOrder_Attack( NearestEnemy, 100.0, 150.0, 30.0);
SetFireStyle_Enemy( NearestEnemy);
m_Active = true;
}
void OnOrderedEnemyKilled()
{
SetFireStyle_Nearest();
DoAttack();
}
}
class CMission7_BaseAmbush extends CBaseAITask_BaseTask
{
boolean m_Active = false;
void DoAttack()
{
string NearestEnemy = GetTargetedEnemy();
if ( NearestEnemy == "")
{
NearestEnemy = GetNearestEnemyUnit();
};
SetOrder_Attack( NearestEnemy, 100.0, 150.0, 30.0);
SetFireStyle_Enemy( NearestEnemy);
m_Active = true;
}
void OnOrderedEnemyKilled()
{
SetFireStyle_Nearest();
DoAttack();
}
}
class CMission7_Ambush_B extends CMission7_BaseAmbush
{
void OnActiveArea_B()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_D extends CMission7_BaseAmbush
{
void OnActiveArea_D()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_E extends CMission7_BaseAmbush
{
void OnActiveArea_E()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_F extends CMission7_BaseAmbush
{
void OnActiveArea_F()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_G extends CMission7_BaseAmbush
{
void OnActiveArea_G()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_H extends CMission7_BaseAmbush
{
void OnActiveArea_H()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_I extends CMission7_BaseAmbush
{
void OnActiveArea_I()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_J extends CMission7_BaseAmbush
{
void OnActiveArea_J()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_L extends CMission7_BaseAmbush
{
void OnActiveArea_L()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_K extends CMission7_BaseAmbush
{
void OnActiveArea_K()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_N extends CMission7_BaseAmbush
{
void OnActiveArea_N()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_M extends CMission7_BaseAmbush
{
void OnActiveArea_M()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_Ambush_O extends CMission7_BaseAmbush
{
void OnActiveArea_O()
{
if ( !m_Active)
{
DoAttack();
};
}
}
class CMission7_SovietWall extends CBaseAITask_BaseTask
{
boolean m_Active = false;
void Init()
{
}
void DoAttack()
{
string NearestEnemy = GetTargetedEnemy();
if ( NearestEnemy == "")
{
NearestEnemy = GetNearestEnemyUnit();
};
SetOrder_Attack( NearestEnemy, 100.0, 150.0, 40.0);
SetFireStyle_Enemy( NearestEnemy);
m_Active = true;
}
void OnOrderedEnemyKilled()
{
SetFireStyle_Nearest();
DoAttack();
}
void OnActiveArea_SovietWall()
{
if ( !m_Active)
{
DoAttack();
};
}
}